home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
dd1a
/
dragdrop.bas
< prev
next >
Wrap
BASIC Source File
|
1995-05-09
|
1KB
|
36 lines
DefInt A-Z
'all the code is in the Main() routine
'Main() is the startup routine for the Drag'N'Drop
'Paul Bonner 76000,13
Sub Main ()
Totfiles = 0
PM_NOREMOVE = 0
PM_NOYIELD = 2
wRemoveMsg = PM_NOREMOVE Or PM_NOYIELD 'parameters for PeekMessage call
DragDropForm.Show
Handle = DragDropForm.Hwnd
Filenum = -1
DragAcceptFiles Handle, True 'identify form as able to accept d/d messages
Do While DoEvents()
x = PeekMessage(NewMessage, Handle, 563, 563, wRemoveMsg) 'determine if a d/d message is waiting
If x <> 0 Then 'if a dd message is waiting
'calling DragQueryFile with a -1 value for FileNum returns # of files dropped
x = DragQueryFile(NewMessage.wparam, Filenum, NameOfFile, 128)
For Counter = 0 To x - 1 ' for each file dropped
'calling with a value greater than -1 returns name of corresponding file
y = DragQueryFile(NewMessage.wparam, Counter, NameOfFile, 128)
'add NameOfFile to List
DragDropForm.list1.AddItem NameOfFile
Next Counter 'get next file
Totfiles = Totfiles + x
DragDropForm.label2.caption = Str$(x) + " files added. " + Str$(Totfiles) + " files in list."
'always call dragfinish to release d/d memory buffer
DragFinish NewMessage.wparam
End If
Loop
End Sub